package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.base.ResponseResult;
import com.zzyl.entity.NursingLevel;
import com.zzyl.vo.NursingLevelVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import com.zzyl.entity.NursingLevel;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * @Description NursingLevelMapper
 * @Author zhangsuye
 * @Date 2024-10-18
 */
@Mapper
public interface NursingLevelMapper {
    /**
     * 新增护理等级
     * @param nursingLevel
     */
    void insert(NursingLevel nursingLevel);

    /**
     * 根据id查询护理等级
     * @param id
     * @return
     */
    NursingLevelVo findById(Long id);

    /**
     * 编辑护理等级
     * @param nursingLevel
     */
    void update(NursingLevel nursingLevel);

    /**
     * 删除护理等级
     * @param id
     */
    void deleteById(Long id);

    /**
     * 启用/禁用护理等级
     * @param id
     * @param status
     */
    void updateStatusById(@Param("id") Long id, @Param("status") Integer status);

    /**
     * 查询所有护理等级
     * @return
     */
    @Select("SELECT nl.*, su.real_name creator, np.plan_name planName\n" +
            "FROM nursing_level nl\n" +
            "         LEFT JOIN sys_user su ON nl.create_by = su.id\n" +
            "         LEFT JOIN nursing_plan np ON nl.lplan_id = np.id\n"+
    "where nl.status = 1")
    NursingLevel[] getAll();


    Page<NursingLevelVo> listByPage(String name, Integer status);
}
